package cn.gson.springboot.model.pojos;

import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Date;
import java.util.Objects;

@Entity
@Table(name = "tracelog_", schema = "crm")
public class Tracelog {
    private int traceId;
    private Date traceDate;
    private String traceStage;
    private String tracePrincipal;
    private Date traceSignDate;
    private BigDecimal traceExpectSum;
    private String tracePriRemark;
    private Opportunity opportunityByOppId;

    @Id
    @Column(name = "trace_id", nullable = false)
    public int getTraceId() {
        return traceId;
    }

    public void setTraceId(int traceId) {
        this.traceId = traceId;
    }


    @Basic
    @Column(name = "trace_date", nullable = true)
    public Date getTraceDate() {
        return traceDate;
    }

    public void setTraceDate(Date traceDate) {
        this.traceDate = traceDate;
    }

    @Basic
    @Column(name = "trace_stage", nullable = true)
    public String getTraceStage() {
        return traceStage;
    }

    public void setTraceStage(String traceStage) {
        this.traceStage = traceStage;
    }

    @Basic
    @Column(name = "trace_principal", nullable = true, length = 255)
    public String getTracePrincipal() {
        return tracePrincipal;
    }

    public void setTracePrincipal(String tracePrincipal) {
        this.tracePrincipal = tracePrincipal;
    }

    @Basic
    @Column(name = "trace_sign_date", nullable = true)
    public Date getTraceSignDate() {
        return traceSignDate;
    }

    public void setTraceSignDate(Date traceSignDate) {
        this.traceSignDate = traceSignDate;
    }

    @Basic
    @Column(name = "trace_expect_sum", nullable = true, precision = 5)
    public BigDecimal getTraceExpectSum() {
        return traceExpectSum;
    }

    public void setTraceExpectSum(BigDecimal traceExpectSum) {
        this.traceExpectSum = traceExpectSum;
    }

    @Basic
    @Column(name = "trace_pri_remark", nullable = true, length = 255)
    public String getTracePriRemark() {
        return tracePriRemark;
    }

    public void setTracePriRemark(String tracePriRemark) {
        this.tracePriRemark = tracePriRemark;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Tracelog tracelog = (Tracelog) o;
        return traceId == tracelog.traceId &&
                Objects.equals(traceDate, tracelog.traceDate) &&
                Objects.equals(traceStage, tracelog.traceStage) &&
                Objects.equals(tracePrincipal, tracelog.tracePrincipal) &&
                Objects.equals(traceSignDate, tracelog.traceSignDate) &&
                Objects.equals(traceExpectSum, tracelog.traceExpectSum) &&
                Objects.equals(tracePriRemark, tracelog.tracePriRemark);
    }

    @Override
    public int hashCode() {
        return Objects.hash(traceId, traceDate, traceStage, tracePrincipal, traceSignDate, traceExpectSum, tracePriRemark);
    }

    @ManyToOne
    @JoinColumn(name = "opp_id", referencedColumnName = "opp_id")
    public Opportunity getOpportunityByOppId() {
        return opportunityByOppId;
    }

    public void setOpportunityByOppId(Opportunity opportunityByOppId) {
        this.opportunityByOppId = opportunityByOppId;
    }
}
